<template>
	<view class="content">
		<view class="box">
			
			<view class="cu-bar search bg-white">
				<view class="search-form round">
					<text class="cuIcon-search"></text>
					<input :adjust-position="false" type="text" placeholder="请输入" confirm-type="search"></input>
					<button class="cu-btn search-btn shadow-blur round">搜索</button>
				</view>
				
			</view>
			<view class="bg-white nav-item">
				<view class="flex flex-wrap">
					<view class="basis-xs border-right">适用省市∨</view>
					<view class="basis-xs ">服务类型∨</view>
					
				</view>
			</view>
		</view>
		<scroll-view
			class="list-scroll-content" 
			scroll-y
			@scrolltolower="loadData"
		>
			<!-- 空白页 -->
			<!-- <empty v-if="tabItem.loaded === true && tabItem.orderList.length === 0"></empty> -->
			
			<view class="cu-list menu-avatar">
				
				<view class="cu-item " v-for="(item,index) in 4" :key="index" @click="goDetail()">
					<view class="content">
						<view class="col-1 flex ">
							<image class="company-img" src="../../../static/images/word.png" ></image>
							<view class="flex-sub padding-left text-con"><view class="text-black text-lg text-title">补贴项目名称</view>
							<view class="text-grey text-df dsc">补贴标准：招聘类型见习岗招聘岗位：HR、会计、销售、运营、前端、后端招聘类型见习岗招聘岗位：HR、会计、销售、运营、前端、后端招聘类型见习岗招聘岗位：HR、会计、销售、运营、前端、后端</view>
							
							<view class="text-grey text-df between"><text class="">适用省市：重庆</text>
							</view>
							</view>	
						</view>
					</view>
				</view>
			</view>
			 
			<!-- <uni-load-more :status="tabItem.loadingType"></uni-load-more> -->
			
		</scroll-view>
	</view>
</template> 

<script>
	import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
	import empty from "@/components/empty";
	export default {
		components: {
			uniLoadMore,
			empty
		},
		data() {
			return {
				tabCurrentIndex: 0,
				navList: [{
						state: 0,
						text: '模板文档',
						loadingType: 'more',
						orderList: []
					},
					{
						state: 1,
						text: '参考文件',
						loadingType: 'more',
						orderList: []
					},
					{
						state: 2,
						text: '收藏资料',
						loadingType: 'more',
						orderList: []
					},
					{
						state: 3,
						text: '已购资料',
						loadingType: 'more',
						orderList: []
					},
				
				],
				modalName: null,
			};
		},
		
		onLoad(options){
			/**
			 * 修复app端点击除全部订单外的按钮进入时不加载数据的问题
			 * 替换onLoad下代码即可
			 */
			// this.tabCurrentIndex = +options.state;
			// // #ifndef MP
			// this.loadData()
			// // #endif
			// // #ifdef MP
			// if(options.state == 0){
			// 	this.loadData()
			// }
			// // #endif
			
		},
		 
		methods: {
			//获取订单列表
			loadData(source){
				//这里是将订单挂载到tab列表下
				let index = this.tabCurrentIndex;
				let navItem = this.navList[index];
				let state = navItem.state;
				
				if(source === 'tabChange' && navItem.loaded === true){
					//tab切换只有第一次需要加载数据
					return;
				}
				if(navItem.loadingType === 'loading'){
					//防止重复加载
					return;
				}
				
				navItem.loadingType = 'loading';
				
				setTimeout(()=>{
					// let orderList = Json.orderList.filter(item=>{
					// 	//添加不同状态下订单的表现形式
					// 	item = Object.assign(item, this.orderStateExp(item.state));
					// 	//演示数据所以自己进行状态筛选
					// 	if(state === 0){
					// 		//0为全部订单
					// 		return item;
					// 	}
					// 	return item.state === state
					// });
					// orderList.forEach(item=>{
					// 	navItem.orderList.push(item);
					// })
					//loaded新字段用于表示数据加载完毕，如果为空可以显示空白页
					this.$set(navItem, 'loaded', true);
					
					//判断是否还有数据， 有改为 more， 没有改为noMore 
					navItem.loadingType = 'more';
				}, 600);	
			}, 
			goDetail(){
				// uni.navigateTo({
				// 	// url: `/pages/works/detail?id=${id}`
				// 	url: `/pages/works/companyInfo`
				// })
			},

			doFavor(){
				this.$api.msg(`点击了收藏`);
			},
			doDown(){
				this.$api.msg(`点击了下载`);
			},
			//swiper 切换
			changeTab(e){
				this.tabCurrentIndex = e.target.current;
				this.loadData('tabChange');
			},
			//顶部tab点击
			tabClick(index){
				this.tabCurrentIndex = index;
				console.log(index)
			},
		},
	}
</script>

<style lang="scss">
	page, .content{
		background: $page-color-base;
		height: 100%;
	}
	
	.search-btn{
		background-color: #4CA5FE !important;
		color: #FFF;
		width: 80px;
	}
	.basis-xs{
		flex-basis: 50%;
		padding: 10px 0;
		text-align: center;
	}
	.border-right{
		border-right: 1upx solid #909399;
	}
	.swiper-box{
		height: calc(100% - 40px);
	}
	.list-scroll-content{
		height: 100%;
	}
	
	.navbar{
		display: flex;
		height: 40px;
		padding: 0 5px;
		background: #fff;
		box-shadow: 0 1px 5px rgba(0,0,0,.06);
		position: relative;
		z-index: 10;
		.nav-item{
			flex: 1;
			display: flex;
			justify-content: center;
			align-items: center;
			height: 100%;
			font-size: 15px;
			color: $font-color-dark;
			position: relative;
			&.current{
				color: #4CA5FE;
			}
		}
	}

	.uni-swiper-item{
		height: auto;
	}
	
	.cu-list>.cu-item.move-cur {
		transform: translateX(-100upx)
	}
	.cu-list>.cu-item .move {
		right: 5px;
		width: 110upx;
	}
	
	.cu-list.menu-avatar {
		margin: 15px;
	}
	
	.cu-item{
		padding: 0 !important;
		height: 90px !important;
		background-color: #F2F6F8 !important;
		margin-bottom: 15px !important;
	}
	.cu-list.menu-avatar>.cu-item .content {
		width: 100%;
		line-height: 1.6em;
		left: 1px;
		background: #FFF;
		z-index: 10;
		border-radius: 10px;
		padding: 10px;
	}
	
	.company-img{
		width: 50px;
		height: 60px;
	}
	.dsc{
		height: 40px !important;
	}
	.between{
		justify-content: space-between;
		display: flex;
	}
	.line{
		border-bottom: 1px solid #4CA5FE;
		padding-bottom: 10px;
		margin-bottom: 10px;
	}
	
	.text-white{
		margin: 0px 15px;
		font-size: 14px;
		text-align: center;
	}
	
	.text-title{
		font-size: 16px !important;
		font-weight: bold;
	}
	
	.text-con{
		width: 60%;
		// height: 120px;
		font-size: 12px;
		line-height: 15px;
		margin-right: 40px;
		.text-df{
			height: 20px;
			padding-top: 5px;
			line-height: 12px;
			font-size: 12px;
			overflow: hidden;
		}
	}
	.icon{
		position: absolute;
		right: 15px;
		width: 25px;
		height: 60px;
		top: 30px;
		display: inline-grid;
		text{
			font-size: 25px;
		}
	}
	.radius{
		border-radius: 10px;
	}
	
	.bg-red {
		border-radius: 0 10px 10px 0;
	}
	.text-info{
		width: 200px;
		height: 30px;
		line-height: 30px;
		overflow: hidden;
		font-size: 14px;
		text{
			margin-right: 20px;
		}
	}
	.col-1{
		justify-content: space-between;
	}
	.agree{
		width: 100px;
		height: 14px;
		font-size: 12px;
		background-color: transparent;
		color: #FC7A7A;
	}
	.reward{
		color: #FF4400;
		font-size: 20px;
		font-weight:bold;
		top: -45px;
		position: relative;
	}
	/* load-more */
	.uni-load-more {
		display: flex;
		flex-direction: row;
		height: 80upx;
		align-items: center;
		justify-content: center
	}
	
	.uni-load-more__text {
		font-size: 28upx;
		color: #999
	}
	
	.uni-load-more__img {
		height: 24px;
		width: 24px;
		margin-right: 10px
	}
	
	.uni-load-more__img>view {
		position: absolute
	}
	
	.uni-load-more__img>view view {
		width: 6px;
		height: 2px;
		border-top-left-radius: 1px;
		border-bottom-left-radius: 1px;
		background: #999;
		position: absolute;
		opacity: .2;
		transform-origin: 50%;
		animation: load 1.56s ease infinite
	}
	
	.uni-load-more__img>view view:nth-child(1) {
		transform: rotate(90deg);
		top: 2px;
		left: 9px
	}
	
	.uni-load-more__img>view view:nth-child(2) {
		transform: rotate(180deg);
		top: 11px;
		right: 0
	}
	
	.uni-load-more__img>view view:nth-child(3) {
		transform: rotate(270deg);
		bottom: 2px;
		left: 9px
	}
	
	.uni-load-more__img>view view:nth-child(4) {
		top: 11px;
		left: 0
	}
	
	.load1,
	.load2,
	.load3 {
		height: 24px;
		width: 24px
	}
	
	.load2 {
		transform: rotate(30deg)
	}
	
	.load3 {
		transform: rotate(60deg)
	}
	
	.load1 view:nth-child(1) {
		animation-delay: 0s
	}
	
	.load2 view:nth-child(1) {
		animation-delay: .13s
	}
	
	.load3 view:nth-child(1) {
		animation-delay: .26s
	}
	
	.load1 view:nth-child(2) {
		animation-delay: .39s
	}
	
	.load2 view:nth-child(2) {
		animation-delay: .52s
	}
	
	.load3 view:nth-child(2) {
		animation-delay: .65s
	}
	
	.load1 view:nth-child(3) {
		animation-delay: .78s
	}
	
	.load2 view:nth-child(3) {
		animation-delay: .91s
	}
	
	.load3 view:nth-child(3) {
		animation-delay: 1.04s
	}
	
	.load1 view:nth-child(4) {
		animation-delay: 1.17s
	}
	
	.load2 view:nth-child(4) {
		animation-delay: 1.3s
	}
	
	.load3 view:nth-child(4) {
		animation-delay: 1.43s
	}
	
	@-webkit-keyframes load {
		0% {
			opacity: 1
		}
	
		100% {
			opacity: .2
		}
	}
</style>
